<template>
  <div class="trial-product" v-if="bannerList && bannerList.length > 0">
    <a :href="bannerList[0].skipValue" :target="bannerList[0].openMark" :title="bannerList[0].skipTitle" v-if="bannerList[0].skipModel==2">
      <div class="trial-product__banner">
        <div class="left-group">
          <img class="logo" :src="bannerList[0].cover" alt="">
          <h1 class="btitle">{{bannerList[0].title}}</h1>
          <div class="desc">{{bannerList[0].description}}</div>
        </div>
        <div class="right-btn">
          <span>点击订阅</span>
          <i class="iconfont icon-fabu fz24 pr tp2 cof"></i>
        </div>
        <div class="trial-product__dirver"></div>
      </div>
    </a>
    <a href="JavaScript:void(0);" @click="handleOpenVip" :title="bannerList[0].skipTitle" v-if="bannerList[0].skipModel==1">
      <div class="trial-product__banner">
        <div class="left-group">
          <img class="logo" :src="bannerList[0].cover" alt="">
          <h1 class="btitle">{{bannerList[0].title}}</h1>
          <div class="desc">{{bannerList[0].description}}</div>
        </div>
        <div class="right-btn">
          <span>点击订阅</span>
          <i class="iconfont icon-fabu fz24 pr tp2 cof"></i>
        </div>
        <div class="trial-product__dirver"></div>
      </div>
    </a>
    <teleport to="body">
      <ksd-vip ref="userVipRef"></ksd-vip>
    </teleport>
  </div>
</template>
<script setup>
const userVipRef = ref({})
const props = defineProps({
  type: {
    type: Number,
    default: 1
  }
})

const bannerList = ref([])
/**
 * 查询广告接口
 * @returns
 */
const handleLoadBannerData = async () => {
  const resp = await useLoadAdvertList(props.type)
  bannerList.value = resp.data || []
}

const handleOpenVip = async () => {
  await useLoginDialog()
  userVipRef.value.handleOpen()
}


onMounted(() => {
  handleLoadBannerData()
})
</script>
<style scoped lang="scss">

.trial-product {
  width: 100%;
  min-width: 360px;
  position: relative;
  padding-bottom: 10px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between
}

.trial-product__banner {
  padding: 28px 30px
}


.trial-product .trial-product__banner {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  background: url(https://lhcdn.lanhuapp.com/dashboard/production/assets/mg.858fd372.png) no-repeat, url(https://lhcdn.lanhuapp.com/dashboard/production/assets/right-bg.d6fd5d87.png) no-repeat, linear-gradient(0deg, #ffffff -6%, rgba(255, 255, 255, .8) 13%, rgba(255, 255, 255, 0) 100%), url(https://lhcdn.lanhuapp.com/dashboard/production/assets/banner-background.473912cd.png) no-repeat;
  background-size: 310px 270px, 370px 230px, 100% 100%, 100% 100%;
  background-position: 0 0, 100% 0, 0 0, 0 0
}

.trial-product .trial-product__banner .left-group {
  min-width: 300px
}

.trial-product .trial-product__banner .left-group .logo {
  min-width: 230px;
  height: 60px
}

.trial-product .trial-product__banner .left-group .btitle {
  font-size: 36px;
  font-weight: 600;
  line-height: 58px;
  display: flex;
  align-items: center;
  letter-spacing: 0px;
  font-variation-settings: "opsz" auto;
  color: #1f2126
}

.trial-product .trial-product__banner .left-group .desc {
  font-size: 24px;
  font-weight: 600;
  line-height: 58px;
  display: flex;
  align-items: center;
  letter-spacing: 0px;
  font-variation-settings: "opsz" auto;
  color: #1f2126
}

.trial-product .trial-product__banner .right-btn {
  width: 180px;
  min-width: 180px;
  height: 64px;
  cursor: pointer;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 0 24px;
  gap: 8px;
  border-radius: 12px;
  opacity: 1;
  background: linear-gradient(290deg, #289eff 0%, #7a5af8 100%);
  font-size: 20px
}

.trial-product .trial-product__banner .right-btn span {
  color: #fff;
  font-weight: 600;
  line-height: 32px
}

.trial-product .trial-product__banner .right-btn:hover {
  background: linear-gradient(290deg, #55affe 0%, #937cf9 100%)
}

.trial-product .trial-product__banner .right-btn:active {
  background: linear-gradient(290deg, #227dcb 0%, #6049c6 100%), linear-gradient(290deg, #55affe 0%, #937cf9 100%)
}

.trial-product .trial-product__banner .trial-product__dirver {
  position: absolute;
  bottom: 0px;
  width: 100%;
  height: 1px;
  background: #e5e5e5
}

</style>
<script setup lang="ts">
</script>